package com.nimt.hqgl_idea.controller;


import com.nimt.hqgl_idea.entity.Service;
import com.nimt.hqgl_idea.param.ServiceParam;
import com.nimt.hqgl_idea.service.ServiceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.nimt.hqgl_idea.util.ResponseBody;


@CrossOrigin
@RestController
@RequestMapping("/service")
public class ServiceController {
    @Autowired
    ServiceService serviceService;


    @PostMapping("/add")
    public ResponseBody add(Service service){
        return serviceService.add(service);
    }

    @GetMapping("/query")
    public ResponseBody query(ServiceParam serviceParam){
        return serviceService.query(serviceParam);
    }

    @PostMapping("/state")
    public ResponseBody state(Service service){
        return serviceService.state(service);
    }

    @PutMapping("/updateService")
    public ResponseBody updateService(Service service){
        return serviceService.updateService(service);
    }

    @PostMapping("/del")
    public ResponseBody del(Integer id){
        return serviceService.delete(id);
    }
}
